-
-
Notifications
You must be signed in to change notification settings - Fork 950
fix: use stateOptions when retrieving a Parameter filter #6728
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: use stateOptions when retrieving a Parameter filter #6728
Conversation
a2c48a9 to
11cc1e5
Compare
11cc1e5 to
0affd52
Compare
Replaced state options logic in `ParameterResourceMetadataCollectionFactory` with a new method `getClassFromStateOptions`. This simplifies the code by centralizing the logic in the `Metadata` class and improves readability.
7f2128d to
55f4c94
Compare
1fedd26 to
1fd61cb
Compare
20f4b70 to
c605174
Compare
c605174 to
fe4bce4
Compare
|
this doesn't seem to fully work from what i can see: the |
|
ok, actually, if you try to use a different property name on your entity to your resource class, like the following, the #[ORM\Entity]
class Agent
{
#[ORM\Column]
public ?\DateTimeImmutable $dob = null;
}
...
#[ApiFilter(DateFilter::class, properties: ['dob'], alias: 'app_filter_date')]
#[ApiResource(
shortName: 'Agent',
operations: [
new GetCollection(parameters: [
'birthday' => new QueryParameter(filter: 'app_filter_date'. property: 'dob'),
]),
],
stateOptions: new Options(entityClass: Agent::class)
)]
class AgentApi
{
...
}Querying this does work as expected however: |
|
[before] is a value of our parameter though it should not appear in the template? |
yes, it should appear in the template as per this test:
|
3.4As mentioned in #6682, QueryParamter on DTO with
stateOptionsdoesn't work. This PR will solve this problem by applyingstateOptionsto theParameterResourceMetadataCollectionFactory.